from django.db import models
from osmp.host.models import Product
from django.contrib.auth.models import User

# Create your models here.
class Doc(models.Model):
    pid = models.ForeignKey(Product)
    uid = models.ForeignKey(User)
    type = models.CharField(max_length=1)
    status = models.CharField(max_length=1)
    name = models.CharField(max_length=255)
    context = models.TextField(blank=True)
    timestamp = models.DateTimeField(auto_now_add = True)

    def __unicode__(self):
        return u"id:%s" % (self.id)

    def __str__(self):
        return "id:%s" % (self.id)

class Comment(models.Model):
    did = models.ForeignKey(Doc)
    uid = models.ForeignKey(User)
#    score = models.CharField(max_length=10)
    record = models.CharField(max_length=10)
    content = models.TextField(blank=True)
    timestamp = models.DateTimeField(auto_now_add = True)

    def __unicode__(self):
        return u"id:%s" % (self.id)

    def __str__(self):
        return "id:%s" % (self.id)